package com.example.photo.model.domain;

import com.baomidou.mybatisplus.annotation.*;

import java.io.Serializable;

import com.example.photo.model.request.add.NewPrizeRequest;
import com.example.photo.model.request.update.UpdatePrizeRequest;
import lombok.Data;

/**
 * 奖项
 * @TableName prize
 */
@TableName(value ="prize")
@Data
public class Prize implements Serializable {
    /**
     * 奖项id
     */
    @TableId(type = IdType.AUTO)
    private Integer prizeId;

    /**
     * 奖项名称
     */
    private String prizeName;

    /**
     * 总人数
     */
    private Integer totalNum;

    /**
     * 剩余名额
     */
    private Integer vacantNum;

    /**
     * 奖品名称
     */
    private String goodName;

    /**
     * 奖品链接
     */
    private String goodLink;

    /**
     * 奖品图片
     */
    private String goodPic;

    /**
     * 所属组
     */
    private Integer contestGroup;

    /**
     * 所属赛事id
     */
    private Integer contestId;

    /**
     * 是否删除
     */
    @TableLogic
    private Integer isDeleted;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    public Prize() {
    }

    public Prize(NewPrizeRequest newPrizeRequest) {
        this.prizeName = newPrizeRequest.getPrizeName();
        this.totalNum = newPrizeRequest.getTotalNum();
        this.vacantNum = newPrizeRequest.getTotalNum();
        this.goodName = newPrizeRequest.getGoodName();
        this.goodLink = newPrizeRequest.getGoodLink();
        this.goodPic = newPrizeRequest.getGoodPic();
        this.contestGroup = newPrizeRequest.getContestGroup();
    }

    public Prize(UpdatePrizeRequest updatePrizeRequest) {
        this.prizeId = updatePrizeRequest.getPrizeId();
        this.prizeName = updatePrizeRequest.getPrizeName();
        this.totalNum = updatePrizeRequest.getTotalNum();
        this.goodName = updatePrizeRequest.getGoodName();
        this.goodLink = updatePrizeRequest.getGoodLink();
        this.goodPic = updatePrizeRequest.getGoodPic();
    }
}